<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<c:forEach items="${associationsList}" var="association" varStatus="status">
	<div class="bs-callout">
	<c:choose>
		<c:when test="${status.index eq 0}">
				<a class="product-section-title"><h2>${association.community.universe}</h2></a>	
		</c:when>
		<c:otherwise>
			<a class="product-section-title" href="<c:url value="${association.community.universeCode}" />"><h2>${association.community.universe}</h2></a>	
		</c:otherwise>
	</c:choose>
	<div class="row">
	<c:forEach items="${association.products}" var="product" varStatus="status_product">
		<c:choose>
			<c:when test="${status.index eq 0}">
				<c:if test="${status_product.index eq 0 || status_product.index eq 3}">
					</div>
					<div class="row">
				</c:if>
				<div class="col-md-4 <c:out value="${communitiesCSS[association.community.universeCode]}"/>">	
			</c:when>
			<c:otherwise>
				<div class="col-md-2 <c:out value="${communitiesCSS[association.community.universeCode]}"/>">	
			</c:otherwise>
		</c:choose>
		<a href="/cultu/product/<c:url value="${product.hjid}" />">
			<div class="product-picture">
			<c:forEach items="${product.medias}" var="media" varStatus="status_media">
				<c:if test="${media.main == true}">
					<img src="http://lesbahundes.com/images/facebook_icon.png" />
<%-- 					<img src="${media.url}" /> --%>
				</c:if>
			</c:forEach>
			</div>
			<div class="product-label" data-toggle="tooltip" data-placement="top" title="" data-original-title="${product.label}">${product.label}</div>
			<div class="product-description">${product.description}</div>
			<ul class="product-score">
				<c:forEach begin="0" end="${product.note}">
					<li><img src="<c:url value="/resources/cultural-store/img/star.png" />"/></li>
				</c:forEach>
			</ul>
			<div class="product-price">
				<c:choose>
					<c:when test="${ordersMap[product.hjid] eq true}">
						<span class="label label-success">Acquis</span>
					</c:when>
					<c:when test="${product.price eq 0}">
						<span class="label label-success">Gratuit</span>
					</c:when>
					<c:otherwise>
					
					<c:choose>
						<c:when test="${offerMap[product.hjid] ne null}">
							<c:set var="offerRate" scope="page" value="${offerMap[product.hjid].rate}"/>			
							<c:set var="offerPrice" scope="page" value="${product.price * (100 - offerRate) / 100}"/>			
							<span class="label label-danger"><fmt:formatNumber value="${offerPrice}" pattern="0.00" /> &#8364;</span>
						</c:when>
						<c:otherwise>
							<span class="label label-primary"><fmt:formatNumber value="${product.price}" pattern="0.00" /> &#8364;</span>
						</c:otherwise>
					</c:choose>
					</c:otherwise>
				</c:choose>
			</div>
			<c:if test="${offerMap[product.hjid] ne null}">
				<div class="product-offer">
					<span>- ${offerMap[product.hjid].rate} %</span>
				</div>
			</c:if>
		</a>
		</div>
	</c:forEach>
	</div>
	</div>
</c:forEach>

<!-- https://lh3.ggpht.com/Qgc1-EjGehfeQ4wfMd1QoTmjQSwcA296ZCkEz5D9J-f5cWcOUkIbiYTlf4gOrLNvz-EqyQ=w170-rw -->
<!-- https://lh3.ggpht.com/KOU_OYo92224XWhglvriYmBtUb35knxkHoLzFex-oFBg9Zx90PFXmTNCI7WmYal6dg=w170-rw -->
<!-- http://www.easyicon.net/language.en/3719-bookmark_favorite_star_icon.html -->